<script type="text/javascript">
  $(function() {
     $("#TicketFile").change(function (){
       var fileName = $(this).val();
       fileName=fileName.split('\\');
       fileName = fileName.pop();
       $(".ticket_attach_filename").html(fileName);
     });
  });
</script>
            <table width="100%">
                <tr valign="top">
                    <td width="750">
                        <div class="billing_arcticle_wrapper">
                            <div class="billing_arcticle_title">Тикеты</div>
                            <div class="billing_arcticle_content">
                                <div class="send_ticket_form_wrapper">
					<?php
					    echo $this->Form->create('Ticket',array('type' => 'file','action' => 'send'));
					    echo $this->Form->input('text', array('label' => false,'required' => 1));
					    echo $this->Form->input('orderid', array(
						    'options' => $ids,
						    'label'=>false,
						    'div' => array(
						    'class' => 'sendticketorderselect',
						)
						));
					    echo $this->Form->input('file', array(
						'type' => 'file',
						'label'=>false,
                                                'accept'=>'image/*',
						'div' => array(
						    'class' => 'attachfilediv',
						)
						
						));
                                            echo '<div class="ticket_attach_filename">Файл не выбран</div>';
					    $options = array(
						'label' => 'Отправить тикет',
						'div' => array(
						    'class' => 'sendticketbtn',
						)
					    );
					    echo $this->Form->end($options);
					?>
                                </div>
                                <div class="billing_tickets_list_main_wrp">
					<?php
						foreach($tickets as $ticket)
						{
						    $ticket=$ticket['Ticket'];
						    $ticket_date=date("H:i d.m.Y",$ticket['time']);
						    if($ticket['back']==1)
						    {
							//$name='Служба поддержки';
							echo '<div class="billing_ticket_main_wrp_answer">';
							echo '<div class="billing_ticket_head_answer">'.$ticket_date.'  Служба поддержки</div>';
						    }
						    else
						    {
							$name=$user_login." (для заказа ID ".$ticket['orderid'].")";
							echo '<div class="billing_ticket_main_wrp">';
							echo '<div class="billing_ticket_head">'.$ticket_date.'  '.$name.'</div>';
						    }
						    echo '<div class="billing_ticket_content">';
						    echo '<pre><code>'.$ticket['text'].'</code></pre>';
						    if(strlen($ticket['file'])>2)
							echo "Вложение: <a href='".$ticket['file']."' target='_blank'>".$ticket['file']."</a>";
						    echo '</div>'; //close content div
						    echo '</div>'; //close wrp div
						}					
					?>
                                </div>
                            </div>
                            <div class="billing_article_links_tickets">
				Страницы: <?php   echo $this->Paginator->numbers();?>
                            </div>
                        </div>
                    </td>
                    <td width="280">
                        <?php echo $this->element('faq');?>
                    </td>
                </tr>
            </table>
